<%
previous_page = previous
next_page = self.next
%>

<ul class='navigation'>
  <% if previous_month_page %>
  <li class='previous'><a href='<%=previous_month_page.url%>'><%=previous_month_page.title%></a></li>
  <% end %>
  <li class='title'><%=title%>のアーカイブ</li>
  <% if next_month_page %>
  <li class='next'><a href='<%=next_month_page.url%>'><%=next_month_page.title%></a></li>
  <% end %>
</ul>

<% if previous_page || next_page %>
<ul class='navigation'>
  <% if previous_page %>
  <li class='previous'><a href='<%=previous_page.url%>'>Newer</a></li>
  <% end %>
  <% (1..total_pages).each do |i| %>
    <% if i == current_page %>
    <li class='current_page'><%=i%></li>
    <% else %>
    <li class='not_current_page'><a href='<%=url(i)%>'><%=i%></a></li>
    <% end %>
  <% end %>
  <% if next_page %>
  <li class='next'><a href='<%=next_page.url%>'>Older</a></li>
  <% end %>
</ul>
<% end %>

<% current_day_pages.each do |day| %>
<div id='d_<%=day.date.strftime('%Y%m%d')%>' class='day'>
  <h2><a href='<%=day.url%>'><%= day.date.strftime('%Y年%m月%d日(%a)')%></a></h2>
  <% day.tweets do |tweet| %>
  <div class='tweet' id='t_<%= tweet.id %>'>
    <p class='tw_text'><%= tweet.formatted_text %></p>
    <% if tweet.medias.size > 0 %>
    <div class='media'>
      <% tweet.medias.each do |m|%>
      <p><a href='<%=m.url%>'><img src='<%=m.local_url%>' width='150' height='150' alt='' /></a></p>
      <% end %>
    </div>
    <% end %>
    <div class='tw_posted'>posted at <a href='<%= "http://twitter.com/#{tweet.user['screen_name']}/status/#{tweet.id}"%>' class='time'><%= tweet.created_at.strftime('%H時%M分%S秒')%></a></div>
  </div>
  <% end %>
</div>
<% end %>

<% if previous_page || next_page %>
<ul class='navigation'>
  <% if previous_page %>
  <li class='previous'><a href='<%=previous_page.url%>'>Newer</a></li>
  <% end %>
  <% (1..total_pages).each do |i| %>
    <% if i == current_page %>
    <li class='current_page'><%=i%></li>
    <% else %>
    <li class='not_current_page'><a href='<%=url(i)%>'><%=i%></a></li>
    <% end %>
  <% end %>
  <% if next_page %>
  <li class='next'><a href='<%=next_page.url%>'>Older</a></li>
  <% end %>
</ul>
<% end %>

